/**
 * Created by HSH on 2016/1/15.
 */
define(function () {
    'use strict';
    return {
        controller: function (scope) {
            var self = this;
            this.scope =scope;
            scope.searchText = 'demo';
            scope.personImage = 'https://img1.doubanio.com//img//celebrity//large//1366635541.39.jpg';
            scope.personName = 'Emilia Clarke Emilia Clarke Emilia Clarke Emilia Clarke Emilia Clarke';
            scope.description = $.i18n.text('text_demo');
            scope.hubImage = $.i18n.text('text_poster');
            scope.title = $.i18n.text('text_title');
            scope.year = $.i18n.text('text_year');
            scope.genres = $.i18n.text('genres');
            scope.duration = $.i18n.text('duration');
            scope.comments = $.i18n.text('Comments');
            ePart.app.iptv.demo().success(function (resp) {
                console.log(resp)
            });
            self.getMainColumns();
        },
        getMainColumns: function () {
            var self = this;
            ePart.app.iptv.demo().success(function (resp) {
                var subjects = resp.subjects;
                var searchList = _.map(subjects, function (item) {
                    return {
                        vertical: item.subtype === 'tv'?'vertical':'Parallel',
                        type: item.subtype,
                        poster: item.images.small,
                        title: item.title,
                        year: item.year,
                        genres: item.genres.toString(),
                        duration: '0',
                        comments: item.rating.average

                    }
                });
                self.scope.searchList = searchList;
            });

        }
    }
});